package org.zebias.udpnettydemo.client;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import io.netty.channel.socket.DatagramPacket;
import io.netty.util.CharsetUtil;

import java.net.DatagramSocket;


/**
 * @ClassName UdpClientHandler
 * @Description udp客户端处理类
 * @Author zebias
 * @Date 2021/3/1 17:06
 * @Version 1.0
 **/
public class UdpClientHandler extends SimpleChannelInboundHandler<DatagramPacket> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
        String info = msg.content().toString(CharsetUtil.UTF_8);
        System.out.println(info);
    }
}
